#include "precompiled.h"
#include "healer.h"
using namespace std;
using namespace weo::engine::item;
using namespace weo::engine::character;
bool filterItemHealer(const weo::engine::item::Item* item)
{
    std::vector<weo::engine::item::Attribute>::const_iterator k;
    const std::vector<Attribute> *attrs = item->Attributes();
    bool badattr = false;
    for(k = attrs->begin();k!=attrs->end();k++)
    {
        switch(k->Type())
        {
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 30:
        case 31:
            badattr = true;
            break;
        default:
            break;
        }
    }
    return badattr;
}
void Healer::filterEquip(std::vector<std::vector<const weo::engine::item::Item*>>& items)
{
    std::vector<std::vector<const weo::engine::item::Item*>>::iterator i;
    std::vector<weo::engine::item::Item*>::iterator j;
    for(i = items.begin();i!= items.end();i++)
    {
        i->erase(std::remove_if(i->begin(), i->end(), filterItemHealer),i->end());
    }
    Character::filterEquip(items);
}
void Healer::handleAttribute(const Attribute& attr)
{
    switch(attr.Type())
    {
    default:
        Character::handleAttribute(attr);
        break;
    }
}
void Healer::Init()
{
    m_AttributesVector.push_back("Mana");
    m_AttributesVector.push_back("Intellect");
    m_AttributesVector.push_back("Spirit");
    m_AttributesVector.push_back("Healing");
    m_AttributesVector.push_back("CritSpellRating");
    m_AttributesVector.push_back("HasteSpellRating");
    m_AttributesVector.push_back("MP5");
    m_AttributesVector.push_back("Health");

    Character::Init();

    m_Buffs["Wrath of Air Totem"].Active(true);
    m_Buffs["Manastream Totem"].Active(true);
    m_Buffs["Superior Mana Potions"].Active(true);
    m_Buffs["Blessing of Wisdom"].Active(true);

    Buff *mightyresto = new Buff("Flask of Mighty Restoration");
    mightyresto->addAttribute(Attribute("MP5", 25));
    m_Buffs[mightyresto->Name()] = *mightyresto;

    Buff *sporefish = new Buff("Blackened Sporefish");
    sporefish->addAttribute(Attribute("MP5", 8));
    sporefish->addAttribute(Attribute("Stamina", 20));
    m_Buffs[sporefish->Name()] = *sporefish;

    Buff *gfish = new Buff("Golden Fish Sticks");
    gfish->addAttribute(Attribute("Spirit", 20));
    gfish->addAttribute(Attribute("Healing",44));
    gfish->Active(false);
    m_Buffs[gfish->Name()] = *gfish;

    Buff *supoil = new Buff("Superior Mana Oil");
    supoil->addAttribute(Attribute("MP5", 14));
    m_Buffs[supoil->Name()] = *supoil;

    m_GoodAttributes.erase(weo::engine::item::Attribute::getAttributeValue("CritSpellRating"));
    m_GoodAttributes.erase(weo::engine::item::Attribute::getAttributeValue("SpellDamage"));
}